#ifndef TABLE_TABLE_H
#define TABLE_TABLE_H 1

#include <common/macro/build.h>
#include <common/io.h>
#include <table/column.h>

typedef struct table_t {
	char *name;

	column_t **columns;
	int columns_c;
} table_t;

API_PUBLIC table_t *table_new(char *);
API_PUBLIC void table_destroy(table_t *);
API_PUBLIC void table_add_column(table_t *, column_t *);
API_LIBLOCAL int table_serialize_file(table_t *, iohandle_t);
API_LIBLOCAL table_t *table_deserialize_file(iohandle_t);
API_LIBLOCAL ssize_t table_serialize(table_t *, char *, ssize_t);
API_LIBLOCAL ssize_t table_deserialize(table_t **, const char *, ssize_t);

API_PUBLIC int table_get_column_count(table_t *);
API_PUBLIC char *table_get_column_datatype(table_t *, int);
API_PUBLIC int table_get_column_datatype_args(table_t *, int , char ***, int *);
API_PUBLIC int table_get_column_id(table_t *, char *);
API_PUBLIC char *table_get_column_name(table_t *, int);

#endif
